Jump to content

- PBXConfig

- # PBXConfig.GetUserByAddress

  Followers 0

  VBScript → Lua SwxWare v4.40

  This function returns a list of PBXUser objects which have the given address. Do not mistake these PBXUser objects with the PBXUser interface of the Server Script API.

      g_PBXConfig.GetUserByAddress("101")

  This function returns a list of PBXUser objects which have the given address, 101 in this example. If the address is an internal number, user name, H.323 alias or SIP user ID the returned collection contains the corresponding user object. If the address is a group number or group name the returned list contains PBXUser objects of all group members.

  The returned list is a common VBScript collection, which can be used in the following way:

      Dim oUsers
      Set oUsers = g_PBXConfig.GetUserByAddress("101")

      Dim oUser
      For Each oUser In oUsers
         ' use user object here
      Next

  Each PBXUser object has the following read-only properties:

      UserID
      Name
      EMailAddress
      DataFolder    (obsolete since SwyxWare v6.00)
      State
      Numbers
      NumberOfNewVoicemails  (from SwyxWare v6.00)

  The first four properties are self-explanatory.

  The following VBScript functions make use of the Name property:

  - GetUserNameFromExtension
  - IsUserInGroup

  The State property can have one of the following values:

      ' user state not available
      UserStateUnavailable = 0

      ' user is logged off
      UserStateLoggedOff = 1

      ' user is logged on
      UserStateLoggedOn = 2

      ' user is speaking, at least one call has an external origination or destination
      UserStateSpeakingExternal = 3

      ' a call is currently alerting at one of the user's devices
      UserStateAlerting = 4

      ' user is speaking, none of the calls has an external origination or destination
      UserStateSpeakingInternal = 5

      ' user is away (since SwyxWare 2011)
      UserStateAway = 6

      ' user has do not disturb status (since SwyxWare 2011)
      UserStateDoNotDisturb = 7

      ' busy indication from external presence source (e.g. MS Teams) (since SwyxWare 13)
      UserStateActive3rdParty = 8

  Please note that the status signalling between the user the status should be requested from and the user the current script runs under must be configured (just as in SwyxIt!).

  The following VBScript functions make direct use of the State property:

  - IsAtLeastOneMemberOfGroupBusy
  - IsAtLeastOneMemberOfGroupLoggedOff
  - IsGroupLoggedOff
  - IsUserFree
  - IsUserLoggedOn
  - IsUserLoggedOff
  - UserStatus

  The Numbers property is a VBScript collection containing all numbers assigned to the user.

      Dim n
      Dim sNumbers
      sNumbers = ""
      For Each n In oUser.Numbers
         If sNumbers = "" Then
            sNumbers = n
         Else
            sNumbers = sNumbers & ", " & n
         End If
      Next
      PBXScript.OutputTrace "Numbers: " & sNumbers

  From SwyxWare v6.00 on, the SwyxWare differs between internal and external numbers. The numbers collection includes the internal numbers. There is no possibility to request the configured external numbers of a user. If a number is configured to not being displayed in the global phonebook it will also no added to the numbers collection.

  The NumberOfNewVoicemails property contains the number of unread voicemails as stored in the SwyxWare database. Note: This value does not change when the user reads his voicemail with an email program directly. It will changed correctly when the voicemail is retrieved via SwyxWare's remote inquiry function or when the SwyxIt or Swyxphone's voicemail key is used.

  The following VBScript function switches the new Voicemail signalling for the given user or group on:

  - SetNewVoicemailFlag

  By Tom Wellige

  - May 16, 2022
  Share
  Share
  Followers 0

## Important Information

By using this site, you agree to our Terms of Use and have taken note of our Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.